# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qt6-qtdeclarative
pkgver=6.3.1
pkgrel=0
pkgdesc="Classes for QML and JavaScript languages"
url="https://qt.io/"
arch="all"
license="LGPL-2.1-only AND LGPL-3.0-only AND GPL-3.0-only AND Qt-GPL-exception-1.0"
depends_dev="
	qt6-qtbase-dev
	qt6-qtshadertools-dev
	vulkan-headers
	"
makedepends="$depends_dev
	cmake
	lttng-ust-dev
	perl
	qt6-qtshadertools-dev
	samurai
	"
subpackages="$pkgname-dev"
options="!check" # No tests
builddir="$srcdir/qtdeclarative-everywhere-src-${pkgver/_/-}"

case $pkgver in
	*_alpha*|*_beta*|*_rc*) _rel=development_releases;;
	*) _rel=official_releases;;
esac

source="https://download.qt.io/$_rel/qt/${pkgver%.*}/${pkgver/_/-}/submodules/qtdeclarative-everywhere-src-${pkgver/_/-}.tar.xz"

_qt6_prefix=/usr/lib/qt6

prepare() {
	default_prepare

	export PATH="$PATH:/usr/lib/qt6/bin"
}

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

dev() {
	default_dev

	find "$pkgdir"/"$_qt6_prefix"/bin/ -type f -not -name "qmlscene" | while read -r f; do
		file=$(basename $f)
		amove "${_qt6_prefix#/}"/bin/$file
	done
}


sha512sums="
547b29dcf26f734b32283677b9e02a43a75f3ab4849e578592031fa37babc09e5b1795e719119ba6b9400ef59b16fd387fb97aa3603454775be4a27e19ff065c  qtdeclarative-everywhere-src-6.3.1.tar.xz
"
